#!/usr/bin/env node

import {NbCommandHandler} from './nb/context.js';
import {cloneMixin} from './nb/modules/clone.js';
import {logMixin} from './nb/modules/log.js';
import {infoMixin} from './nb/modules/info.js';
import {goMixin} from './nb/modules/go.js';
import {buildMixin} from './nb/modules/build.js';
import {mergeMixin} from './nb/modules/merge.js';
import {initMixin} from './nb/modules/init.js';

// 将各模块的实现挂载到处理器原型上，保持对外行为不变
Object.assign(
    NbCommandHandler.prototype,
    cloneMixin,
    logMixin,
    infoMixin,
    goMixin,
    buildMixin,
    mergeMixin,
    initMixin
);

/**
 * 主执行函数 - 供 router.js 调用
 */
export async function execute(args) {
    const handler = new NbCommandHandler();
    await handler.parseAndExecute(args);
}
